package cn.zswltech.gruul.listener;

import cn.zswltech.gruul.biz.service.OrgService;
import cn.zswltech.gruul.biz.service.UserService;
import cn.zswltech.gruul.xxljob.YunHuInfoQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author Jim
 * @version 1.0.0
 * @descripition:
 * @date 2024/2/23 9:58
 */
@Component
@Slf4j
public class ApplicationStartListener implements ApplicationRunner {

    @Autowired
    private UserService userService;

    @Autowired
    private OrgService orgService;

    @Autowired
    private YunHuInfoQueue yunHuInfoQueue;

    @Override
    public void run(ApplicationArguments args) {
        // 推送用户数据到redis
        userService.pushUser2Redis();
        // 推送机机构数据到redis
        orgService.pushOrg2Redis();
        // 云湖数据同步监听
        new Thread(yunHuInfoQueue, "云湖数据同步启动监听").start();
    }
}
